package com.limedia.explorer.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class CommonUtils {

	public static boolean isIpAddressValid(String ipAddress){
		if(ipAddress.length() < 7 || ipAddress.length() > 15 || "".equals(ipAddress)){
			return false;
		}
		else{
			String rexp = "([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}";
			Pattern pat = Pattern.compile(rexp);  
			Matcher mat = pat.matcher(ipAddress);  
			return mat.matches();
		}
	}
}
